﻿using System.ServiceProcess;
using System.Threading;
using SZipHandler;

namespace SZipService
{
    public partial class SZService : ServiceBase
    {
        private Worker _worker;

        public SZService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            _worker = new Worker();
            var thread = new Thread(_worker.Work);
            thread.Start();
        }

        protected override void OnStop()
        {
            if (_worker != null)
                _worker.End = true;
        }
    }
}
